<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    var list = [1, 3, 2, 1, 2, 3, 3, 1, 2];

    for (var i = 0; i < list.length - 1; i++) {
        for (var j = 0; j < list.length - 1 - i; j++) {
            if (list[j] > list[j + 1]) {
                var temp = list[j];
                list[j] = list[j + 1];
                list[j + 1] = temp;
            }
        }
    }
    console.log(list);


    var list = [1, 3, 2, 1, 2, 3, 3, 1, 2];
    for (var i = 0; i < list.length - 1; i++) {
        // i 每次循环当前的
        // j 后面所有的
        for (var j = i + 1; j < list.length; j++) {
            if (list[i] > list[j]) {
                var temp = list[i];
                list[i] = list[j];
                list[j] = temp;
            }
        }
    }
    console.log(list);

    var list = ["A001","华为Meta40 pro","5999.00","5799.00"]

    // 对一个或一类事物特征(属性 =>值类型和引用类型)和行为(方法 函数)的描述
    var goods = {
        goodsId:"A001",   // 特征(属性)
        goodsName:"华为Meta40 pro",
        oldPrice:5999.00,
        curPrice:"5799.00",
        say:function(){   //行为(方法)
            console.log("这是华为Meta40 pro");
        }
    }

    console.log(goods.say);
    console.log(goods["say"]);

    goods.say();
    goods["say"]();


</script>

</html>